<?php
    require_once '../../common/DBHelper.php';

    // 根据id准备sql语句，进行查询
    $id = $_POST['id'];
    $conn = conn();
    $sql = "SELECT * FROM posts WHERE id = {$id}";
    $res = query($conn,$sql);
    $response = ['code' => 0,'msg' => '操作失败'];
    if($res){
        $response['code'] = 1;
        $response['msg'] = '操作成功';
        $response['data']=$res[0];
    }
    echo json_encode($response,JSON_UNESCAPED_UNICODE);
?>